package com.bafa.util.comparators;

import java.util.Comparator;

import com.bafa.objects.Match;

public class MatchByBiggestMarginComparator implements Comparator {

	public int compare(Object arg0, Object arg1) {
		Match match1 = (Match)arg0;
		Match match2 = (Match)arg1;
		
		int margin1 = (match1.getGoalsA()>match1.getGoalsB())?match1.getGoalsA()-match1.getGoalsB():match1.getGoalsB()-match1.getGoalsA();
		int margin2 = (match2.getGoalsA()>match2.getGoalsB())?match2.getGoalsA()-match2.getGoalsB():match2.getGoalsB()-match2.getGoalsA();
		
		
		return margin2-margin1;
	}

}
